package com.example.home_model.details;

import com.example.common.mvvm.repository.BaseRepository;
import com.example.home_model.details.deleteEntity.DeleteEntity;
import com.example.home_model.details.entity.commentaddentity.DetailsEntity;
import com.example.home_model.details.entity.commententity.CommentEntity;
import com.example.network_skd.BaseEntity;
import com.example.network_skd.SingletonRetrofit;

import io.reactivex.Observable;

public class DetailsRepository extends BaseRepository {
    public Observable<BaseEntity> requestAddComment( String commentText, Integer height, String image_url,
                                                     Long itemId, Long userId, String video_url, Integer width){

        Observable<DetailsEntity> detailsEntityObservable = SingletonRetrofit.getInstance().getRetrofit()
                .create(ApiServer.class)
                .requestAddComment(commentText, height, image_url, itemId, userId, video_url, width);


        return checkNetWork(detailsEntityObservable);
    }

    public Observable<BaseEntity> requestCommentList(Long id,Long itemId,int pageCount,Long userId){
        Observable<CommentEntity> commentEntityObservable = SingletonRetrofit.getInstance().getRetrofit()
                .create(ApiServer.class)
                .requestCommentList(id, itemId, pageCount, userId);

        return checkNetWork(commentEntityObservable);
    }

    public Observable<BaseEntity> requestDelete( Long commentId, Long itemId, Long userId){
        Observable<DeleteEntity> deleteEntityObservable = SingletonRetrofit.getInstance().getRetrofit()
                .create(ApiServer.class)
                .requestDeleteComment(commentId, itemId, userId);

        return checkNetWork(deleteEntityObservable);
    }
}
